<!DOCTYPE html>
<html lang="en">
<head>
	<title></title>
	<meta charset="UTF-8"/>
	<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
	<link rel="stylesheet" href="__PUBLIC__/Admin/css/bootstrap.min.css?v={#$Think.config.ADMIN_VERSION_VAL}"/>
	<link rel="stylesheet" href="__PUBLIC__/Admin/css/bootstrap-responsive.min.css?v={#$Think.config.ADMIN_VERSION_VAL}"/>
	<link rel="stylesheet" href="__PUBLIC__/Admin/css/uniform.css?v={#$Think.config.ADMIN_VERSION_VAL}"/>
	<link rel="stylesheet" href="__PUBLIC__/Admin/css/matrix-style2.css?v={#$Think.config.ADMIN_VERSION_VAL}"/>
	<link rel="stylesheet" href="__PUBLIC__/Admin/css/matrix-media.css?v={#$Think.config.ADMIN_VERSION_VAL}"/>
	<link rel="stylesheet" href="__PUBLIC__/Admin/font-awesome/css/font-awesome.css?v={#$Think.config.ADMIN_VERSION_VAL}"/>
	<link rel="stylesheet" href="__PUBLIC__/Admin/css/changyun.css?v={#$Think.config.ADMIN_VERSION_VAL}"/>
	<link rel="stylesheet" href="__PUBLIC__/umeditor/themes/default/css/umeditor.css">
	<link rel="stylesheet" href="__PUBLIC__/filemanage/app.css?v={#$Think.config.ADMIN_SOURCE_VERSION}">
	<link rel="stylesheet" href="//at.alicdn.com/t/font_783249_m68ye1gfnza.css">
	<script src="//at.alicdn.com/t/font_783249_e5yrsf08rap.js"></script>
	<style>
		.control-group .controls label {
			display: inline-block;
		}

		ul, li {
			list-style: none;
		}

		.upload_img_list {
			width: 100%;
			display: block;
		}

		.upload_img_list li {
			float: left;
			margin-right: 5px;
			margin-bottom: 10px;
		}

		.upload_img_list li img {
			width: 80px;
			height: 80px;
			border: 1px solid #cccccc;
			padding: 1px;
		}

		.tab_on_select {
			background: #5bb75b;
		}

		.tab_on_select a {
			color: #ffffff;
		}
	</style>
	<script>
	var BASE_URL = '{#$base_url}';
	var STORE_URL = "{#$admin_url}";
	</script>
</head>
<body>
<div id="content">
	<include file="Public/maintop"/>
	<div class="container-fluid" style="padding:0px 10px;">
		<div class="row-fluid">
			<div class="span12">
				<div class="widget-box">
					<div class="cyz-m-tab">
						<ul class="cyz-m-tab-title">
							<li class="cyz-m-this" data-toggle="nav_tab" href="#tab1">基本信息</li>
							<li data-toggle="nav_tab" href="#tab2">执业资格</li>
						</ul>
					</div>
					<div class="widget-content">
						<form action="{#$this_url_action}" method="post" class="form-horizontal" id="form_basic_validate">
							<div id="tab1" class="tab-pane active">
								<div class="control-group">
									<label class="control-label"><span class="cyzFontRed">* </span>公司名称（中文） :</label>
									<div class="controls">
										<input type="text" class="span3" name="c_cn_company_name" value="{#$info.c_cn_company_name}"/>
									</div>
								</div>
								<div class="widget-content nopadding">
									<div class="control-group">
										<label class="control-label"><span class="cyzFontRed">* </span>姓名（中文） :</label>
										<div class="controls">
											<input type="text" class="span3" name="c_cn_true_name" value="{#$info.c_cn_true_name}"/>
										</div>
									</div>
									<div class="control-group">
										<label class="control-label"><span class="cyzFontRed">* </span>职位（中文） :</label>
										<div class="controls">
											<input type="text" class="span3" name="c_cn_position" value="{#$info.c_cn_position}"/>
										</div>
									</div>
									<div class="control-group">
										<label class="control-label">公司LOGO（300*395）:</label>
										<div class="controls">
											<div class="am-form-file">
												<button type="button" data-input-name="c_touxiang" data-file-type="image" data-is-multiple="0"
														class="upload-file btn btn-success">
													<i class="icon-upload-alt"></i> 选择图片
												</button>
												<div class="uploader-list am-cf">
													<neq name="info.c_touxiang" value="">
														<div class="file-item">
															<a href="{#$info.c_touxiang}" title="点击查看大图"
																	target="_blank">
																<img src="{#$info.c_touxiang}">
															</a>
															<input type="hidden" name="c_touxiang"
																	value="{#$info.c_touxiang}">
															<i class="iconfont icon-shanchu file-item-delete"></i>
														</div>
													</neq>
												</div>
											</div>
										</div>
									</div>
									<div class="control-group">
										<label class="control-label">微信二维码（500*500）:</label>
										<div class="controls">
											<div class="am-form-file">
												<button type="button" data-input-name="c_weixin_img" data-file-type="image" data-is-multiple="0"
														class="upload-file btn btn-success">
													<i class="icon-upload-alt"></i> 选择图片
												</button>
												<div class="uploader-list am-cf">
													<neq name="info.c_weixin_img" value="">
														<div class="file-item">
															<a href="{#$info.c_weixin_img}" title="点击查看大图"
																	target="_blank">
																<img src="{#$info.c_weixin_img}">
															</a>
															<input type="hidden" name="c_weixin_img"
																	value="{#$info.c_weixin_img}">
															<i class="iconfont icon-shanchu file-item-delete"></i>
														</div>
													</neq>
												</div>
											</div>
										</div>
									</div>
									<div class="control-group">
										<label class="control-label"><span class="cyzFontRed">* </span>手机 :</label>
										<div class="controls">
											<input type="text" class="span3" name="c_phone" value="{#$info.c_phone}"/>
										</div>
									</div>
									<div class="control-group">
										<label class="control-label"><span class="cyzFontRed">* </span>电话 :</label>
										<div class="controls">
											<input type="text" class="span3" name="c_telephone" value="{#$info.c_telephone}"/>
										</div>
									</div>
									<div class="control-group">
										<label class="control-label"><span class="cyzFontRed">* </span>邮箱 :</label>
										<div class="controls">
											<input type="text" class="span3" name="c_email" value="{#$info.c_email}"/>
										</div>
									</div>
									<div class="control-group">
										<label class="control-label"><span class="cyzFontRed">* </span>地址 :</label>
										<div class="controls">
											<input type="text" class="span3" name="c_address" value="{#$info.c_address}"/>
										</div>
									</div>
									<div class="control-group">
										<label class="control-label"><span class="cyzFontRed">* </span>公司网址 :</label>
										<div class="controls">
											<input type="text" class="span5" name="c_www_url" value="{#$info.c_www_url}"/>
										</div>
									</div>
									<div class="control-group">
										<label class="control-label"><span class="cyzFontRed">* </span>公司网址 :</label>
										<div class="controls">
											<input type="text" class="span5" name="c_www_url" value="{#$info.c_www_url}"/>
										</div>
									</div>
									<div class="control-group">
										<label class="control-label">公司简介 :</label>
										<div class="controls">
											<textarea name="company_jianjie" id="company_jianjie">{#$info.company_jianjie}</textarea>
										</div>
									</div>
									<div class="control-group">
										<label class="control-label">业务范围 :</label>
										<div class="controls">
											<textarea name="yewu_jianjie" id="yewu_jianjie">{#$info.yewu_jianjie}</textarea>
										</div>
									</div>
								</div>
							</div>
							<div id="tab2" class="tab-pane" style="display: none;">
								<div class="widget-content nopadding">
									<div class="control-group">
										<label class="control-label">相关直播 :</label>
										<div style="margin-top: 10px;" id="flow_content">
											<volist name="info.zhibo_list" id="zhibo_list_info">
												<div id="zhibo_list_{#$key}" class="t_flow">
													<div class="controls" style="padding:2px;">
														<div class="add-on-div">直播{#$key+1}</div>
														<div class="input-append">
															<input type="text" style="width: 300px"
																	name="zhibo_list[nickname][]"
																	value="{#$zhibo_list_info.nickname}"
																	placeholder="请输入直播昵称~"/>
														</div>
													</div>
													<div class="controls" style="padding:2px;">
														<div class="input-append">
															<input type="text" style="width: 300px"
																	name="zhibo_list[link_url][]"
																	value="{#$zhibo_list_info.link_url}"
																	placeholder="请输入口令链接~"/>
														</div>
													</div>
													<div class="controls" id="img_{#$key}">
														<div class="upload_img_list" id="lit_pic_{#$key}_data">
															<if condition="$zhibo_list_info['avatar']">
																<li><img src="{#$zhibo_list_info.avatar}"/></li>
															</if>
														</div>
														<input type="hidden" class="span5"
																name="zhibo_list[avatar][]"
																id="lit_pic_{#$key}_data_value"
																value="{#$zhibo_list_info.avatar}"/>
														<div style="width:100%;display: inline-block;">
															<a href="javascript:void(0);"
																	onclick="upOneImage('{#$key}_data');"
																	class="btn btn-success" style="padding:5px 12px;">上传图片</a>
														</div>
													</div>
													<if condition="$key neq 0">
														<a style="margin-left:200px" class="btn btn-danger" href="###"
																onClick="removeFlow(this);">- 删除直播</a>
													</if>
												</div>
											</volist>
											<a style="margin-left:200px" class="btn btn-primary" href="###"
													onClick="appendFlow();">+ 增加直播</a>
										</div>
									</div>
								</div>
							</div>
							<div class="form-actions">
								<input type="hidden" name="id" value="{#$info.id|default=''}">
								<button type="submit" class="btn btn-success">保存</button>
							</div>
						</form>
					</div>
				</div>

			</div>
		</div>
		<hr>
	</div>
</div>
</div>
<textarea id="upload_editor" style="width: 0;height: 0;display: none;"></textarea>
<!-- 图片文件列表模板 -->
<script id="tpl-file-item" type="text/template">
{{ each list }}
{{ if $value.file_type == 'image' }}
<div class="file-item">
	<a href="{{ $value.file_path }}" title="点击查看大图" target="_blank">
		<img src="{{ $value.file_path }}">
	</a>
	<input type="hidden" name="{{ name }}" value="{{ $value.file_path }}">
	<input type="hidden" name="{{ name }}_id" value="{{ $value.file_id }}">
	<i class="iconfont icon-shanchu file-item-delete"></i>
</div>
{{ /if }}
{{ if $value.file_type == 'file' }}
<div class="file-item">
	<input type="text" name="{{ name }}" value="{{ $value.file_path }}" style="width:500px;">
	<i class="iconfont icon-shanchu file-item-delete"></i>
</div>
{{ /if }}
{{ if $value.file_type == 'video' }}
<div class="file-item">
	<input type="text" name="{{ name }}" value="{{ $value.file_path }}" style="width:500px;">
	<i class="iconfont icon-shanchu file-item-delete"></i>
</div>
{{ /if }}
{{ /each }}
</script>

<!-- 文件库弹窗 -->
<include file="Public/_template/file_library"/>

<script src="__PUBLIC__/Admin/js/jquery.min.js"></script>
<script src="__PUBLIC__/Admin/js/jquery.ui.custom.js"></script>
<script src="__PUBLIC__/Admin/js/bootstrap.min.js"></script>
<script src="__PUBLIC__/Admin/js/jquery.uniform.js"></script>
<script src="__PUBLIC__/Admin/js/matrix.js"></script>
<script src="__PUBLIC__/Admin/js/matrix.tables.js"></script>
<script src="__PUBLIC__/js/layer/layer.js"></script>
<script src="__PUBLIC__/js/Validform.min.js"></script>
<script src="__PUBLIC__/js/laydate/laydate.js"></script>
<script src="__PUBLIC__/ueditor/ueditor.config.js" type="text/javascript"></script>
<script src="__PUBLIC__/ueditor/ueditor.all.js?v=123456" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/ueditor/lang/zh-cn/zh-cn.js"></script>
<script>
</script>
<script type="text/javascript">
function appendFlow() {
	var start = $('.t_flow').length;
	var add_id = start - 1;
	$('#zhibo_list_' + add_id).after(`
			<div id="zhibo_list_${start}" class="t_flow">
				<div class="controls" style="padding:2px;">
					<div class="add-on-div">直播${start + 1}</div>
					<div class="input-append">
					    <input type="text"  style="width: 300px" name="zhibo_list[nickname][]" placeholder="请输入直播昵称~"/>
					</div>
				</div>
				<div class="controls" style="padding:2px;">
				    <div class="input-append">
					   <input type="text"  style="width: 300px" name="zhibo_list[link_url][]" placeholder="请输入口令连接~"/>
					</div>
                 </div>
				<div class="controls" id="img_${start}">
					<div class="upload_img_list" id="lit_pic_${start}_data"></div>
					<input type="hidden" class="span5" name="zhibo_list[avatar][]" id="lit_pic_${start}_data_value" value=""/>
					<div style="width:100%;display: inline-block;">
						<a href="javascript:void(0);" onclick="upOneImage('${start}_data')" class="btn btn-success" style="padding:5px 12px;">上传头像</a>
					</div>
				</div>
				<a style="margin-left:200px" href="###" class="btn btn-danger" onClick="removeFlow(this);">- 删除直播</a>
			</div>
		`);
	$('#zhibo_list_' + start).find('input[type=radio]').uniform();

}
function removeFlow(e) {
	$(e).parent().remove();
	$('.t_flow').each(function (index, item) {
		$(item).attr('id', `zhibo_list_${index}`)
		$(item).find('.add-on-div').text('直播' + (index + 1))
	})
}
var ue_uploader = UE.getEditor('upload_editor', {autoHeightEnabled: false, serverUrl: "{#:U('NewUpload/upload')}"});
function upOneImage(fname) {
	ue_uploader.ready(function () {
		var pickey = 1;
		ue_uploader.addListener('beforeInsertImage', function (t, arg) {
			if (pickey == 1) {
				$("#lit_pic_" + fname).html('<li><img src="' + arg[0].src + '" /></li>');
				$("#lit_pic_" + fname + "_value").val(arg[0].src);
			}
			pickey++;
		});
	});
	var myImage = ue_uploader.getDialog("insertimage");
	myImage.render();
	myImage.open();
}
$(function() {
	$('[data-toggle="nav_tab"]').on('click', function() {
		var self = $(this);
		self.parent().children("li").removeClass("cyz-m-this");
		$(".tab-pane").hide();
		self.addClass("cyz-m-this");
		$(self.attr("href")).show();
	});

	// 富文本编辑器
	UM.getEditor('company_jianjie', {
		initialFrameWidth: 375,
		initialFrameHeight: 300
	});
	UM.getEditor('yewu_jianjie', {
		initialFrameWidth: 375,
		initialFrameHeight: 300
	});

	$('.upload-file').each(function() {
		var _this = $(this), uploadAcceptExtensions;
		var file_type = _this.attr('data-file-type');
		var is_multiple = _this.attr('data-is-multiple');
		if (file_type == 'image') {
			uploadAcceptExtensions = 'gif,jpg,jpeg,bmp,png';
		} else if (file_type == 'file') {
			uploadAcceptExtensions = 'txt,pem,crt';
		} else if (file_type == 'video') {
			uploadAcceptExtensions = 'mp3,mp4';
		}
		$(this).selectImages({
			uploadType: file_type,//上传类型 image 图片  file 文件 video 视频
			uploadSizeLimit: 2, //文件大小 单位M
			uploadAcceptExtensions: uploadAcceptExtensions,//上传文件后缀
			name: _this.attr('data-input-name'),
			multiple: is_multiple == 1 ? true : false//是否多图上传
		});
	});

	var loadi = null;
	var demo1 = $("#form_basic_validate").Validform({
		tiptype: 3,
		ajaxPost: true,
		postonce: true,
		tiptype: function(msg, o, cssctl) {
			if (!o.obj.is("form")) {
				var objtip = o.obj.siblings(".Validform_checktip");
				cssctl(objtip, o.type);
				objtip.text(msg);
			}
		},
		beforeSubmit: function(curform) {
			loadi = layer.load('表单正在处理中，请稍等 ...');
		},
		callback: function(data) {
			layer.close(loadi);
			if (data.status == 1) {
				layer.alert(data.msg, {icon: 1}, function() {
					window.location.href = "{#:U('index')}";
				});
			} else {
				layer.alert(data.msg, {icon: 0});
			}
		}
	});

	$("img").click(function() {
		var img_url = $(this).attr('src');
		layer.open({
			type: 1,
			title: false,
			closeBtn: 0,
			area: ['600px', '600px'],
			skin: 'layui-layer-nobg',
			shadeClose: true,
			content: '<img src="' + img_url + '" />'
		});
	});
});
</script>
</body>
</html>
